home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{8416B1C5-B384-11D2-BC2F-A45A05C10000}#1.0#0"; "EASYSP.OCX"
- Begin VB.Form frmExample
- Caption = "Example"
- ClientHeight = 5430
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 9855
- LinkTopic = "Form1"
- ScaleHeight = 5430
- ScaleWidth = 9855
- StartUpPosition = 3 'Windows Default
- Begin EasyServicePack.EasySP EasySP1
- Left = 60
- Top = 330
- _ExtentX = 794
- _ExtentY = 794
- LogFileName = "logerr.txt"
- ActionFileName = "easySP.txt"
- LogFilePath = "C:\WINDOWS\"
- ActionFilePath = "C:\WINDOWS\"
- Delimiter = ";"
- End
- Begin VB.CommandButton Command1
- Caption = "&Load Action File"
- Height = 525
- Left = 7050
- TabIndex = 8
- Top = 720
- Width = 2205
- End
- Begin VB.CommandButton cmdSaveAction
- Caption = "Save &Action File"
- Height = 525
- Left = 4740
- TabIndex = 7
- Top = 720
- Width = 2205
- End
- Begin VB.CommandButton cdmGetAction
- Caption = "&Show Action File"
- Height = 525
- Left = 2430
- TabIndex = 6
- Top = 720
- Width = 2205
- End
- Begin VB.CommandButton cmdGetFile
- Caption = "Show &Log File"
- Height = 525
- Left = 120
- TabIndex = 5
- Top = 720
- Width = 2205
- End
- Begin VB.TextBox txtContents
- BeginProperty Font
- Name = "Courier New"
- Size = 8.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 4065
- Left = 0
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 4
- Top = 1320
- Width = 9765
- End
- Begin VB.CommandButton cmdTest4
- Caption = "Test &4 (warning, halt!)"
- Height = 555
- Left = 7050
- TabIndex = 3
- Top = 90
- Width = 2205
- End
- Begin VB.CommandButton cmdTest3
- Caption = "Test &3"
- Height = 555
- Left = 4740
- TabIndex = 2
- Top = 90
- Width = 2205
- End
- Begin VB.CommandButton cmdTest2
- Caption = "Test &2"
- Height = 555
- Left = 2430
- TabIndex = 1
- Top = 90
- Width = 2205
- End
- Begin VB.CommandButton cmdTest1
- Caption = "Test &1"
- Height = 555
- Left = 120
- TabIndex = 0
- Top = 90
- Width = 2205
- End
- Attribute VB_Name = "frmExample"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- Dim x As Integer
- Dim hhh As HHCtrl
- Private Sub Command1_Click()
- EasySP1.LoadActionFile
- End Sub
- Private Sub Form_Load()
- EasySP1.ActionFilePath = App.Path & "\"
- EasySP1.LogFilePath = App.Path & "\"
- EasySP1.LoadActionFile
- End Sub
- Private Sub cdmGetAction_Click()
- txtContents.Text = GetText(App.Path & "\" & "easysp.txt")
- cmdSaveAction.Enabled = True
- End Sub
- Private Sub cmdGetFile_Click()
- txtContents.Text = GetText(App.Path & "\" & "logerr.txt")
- cmdSaveAction.Enabled = False
- End Sub
- Private Sub cmdSaveAction_Click()
- SaveText App.Path & "\" & "easysp.txt", txtContents.Text
- End Sub
- Private Sub cmdTest1_Click()
- On Error GoTo ErrLabel
- Dim times As Integer
- Dir "a:" '--------> error simulation
- MsgBox "don't end"
- Exit Sub
- ErrLabel:
- EasySP1.ErrorScope = Screen.ActiveForm.Name & "-" & _
- Screen.ActiveControl.Name
- If EasySP1.UseResume(Err, 52) Then
- times = times + 1 '--------> allow exit loop
- Resume
- ElseIf EasySP1.UseResumeNext(Err, 55) Then
- Resume Next
- ElseIf EasySP1.UseExit(Err, 11) Then
- Exit Sub
- Else: EasySP1.UseRaiseError Err
- End If
- End Sub
- Private Sub cmdTest2_Click()
- On Error GoTo ErrLabel
- Err.Raise 55 '--------> error simulation
- MsgBox "don't end"
- Exit Sub
- ErrLabel:
- EasySP1.ErrorScope = Screen.ActiveForm.Name & _
- Screen.ActiveControl.Name
- If EasySP1.UseResume(Err, 52) Then
- Resume
- ElseIf EasySP1.UseResumeNext(Err, 55) Then
- Resume Next
- ElseIf EasySP1.UseExit(Err, 11) Then
- Exit Sub
- Else: EasySP1.UseRaiseError Err
- End If
- End Sub
- Private Sub cmdTest3_Click()
- On Error GoTo ErrLabel
- x = 1 / 0 '--------> error 11
- MsgBox "don't end"
- Exit Sub
- ErrLabel:
- EasySP1.ErrorScope = Screen.ActiveForm.Name & _
- Screen.ActiveControl.Name
- If EasySP1.UseResume(Err, 52) Then
- Resume
- ElseIf EasySP1.UseResumeNext(Err, 55) Then
- Resume Next
- ElseIf EasySP1.UseExit(Err, 11) Then
- Exit Sub
- Else: EasySP1.UseRaiseError Err
- End If
- End Sub
- Private Sub cmdTest4_Click()
- On Error GoTo ErrLabel
- Err.Raise 76 '--------> error simulation
- MsgBox "don't end"
- Exit Sub
- ErrLabel:
- EasySP1.ErrorScope = Screen.ActiveForm.Name & _
- Screen.ActiveControl.Name
- If EasySP1.UseResume(Err, 52) Then
- Resume
- ElseIf EasySP1.UseResumeNext(Err, 55) Then
- Resume Next
- ElseIf EasySP1.UseExit(Err, 11) Then
- Exit Sub
- Else: EasySP1.UseRaiseError Err
- End If
- End Sub
- Function GetText(FileName As String) As String
- Dim n As Integer
- Dim res As String
- Dim lin As String
- n = FreeFile
- 'On Error GoTo ExitS
- Open FileName For Input As #n
- Do Until EOF(n)
- Line Input #n, lin
- res = res & lin & vbCrLf
- GetText = res
- Close #n
- Exit Function
- ExitS:
- txtContents.Text = ""
- End Function
- Sub SaveText(FileName As String, TxtInfo As String)
- Dim n As Integer
- n = 18
- Open FileName For Output As #n
- Print #n, TxtInfo
- Close #n
- End Sub
-